<?php

use Illuminate\Routing\Router;

Admin::routes();

Route::group([
    'prefix'        => config('admin.route.prefix'),
    'namespace'     => config('admin.route.namespace'),
    'middleware'    => config('admin.route.middleware'),
    'as'            => config('admin.route.prefix') . '',
], function (Router $router) {

    $router->get('/', 'HomeController@index')->name('home');
    $router->get('/dashboard', 'HomeController@dashboard')->name('dashboard');
    $router->get('auth/login', 'AuthController@getLogin');
    $router->post('auth/login', 'AuthController@postLogin');

    $router->resources([
        // 商品
        'stores' => StoreController::class,
        // 材料进销存
        'purchases' => PurchaseController::class,
        'suppliers' => SupplierController::class,
        'materials' => MaterialController::class,
        'material-classifies' => MaterialClassifyController::class,
        'record-materials' => RecordMaterialController::class,
        'record-goods' => RecordGoodsController::class,
        //'orders'=> OrderController::class,
        'configs'=> ConfigController::class,
        'news' => NewsController::class,
        'members'=> MemberController::class,
        'member-levels'=> MemberLevelController::class,
        'record-pays' => RecordPayConctroller::class,
        'record-balances' => RecordBalanceConctroller::class,
        'record-recharges' => RecordRechargeController::class,
        'record-storages' => RecordStorageController::class,
        'users' => UserController::class,
        'coupons' => CouponController::class,
        'activity-recharges' => ActivityRechargeController::class,
	    'banners' => BannerController::class,
	    'distributors' => DistributorController::class,
	    'distributor-levels' => DistributorLevelController::class,
	    'distributor-applies' => DistributorApplyController::class,
	    'distributor-banks' => DistributorBankController::class,
	    'distributior-withdrawals' => DistributiorWithdrawalController::class,
	    'staffs' => StaffController::class,
	    'departments' => DepartmentController::class,
	    'filters' => FilterController::class,
	    'staff-practices' => RecordStaffPracticeController::class,
	    'point-goods' => PointGoodsController::class,
	    //'point-goods-orders' => PointGoodsOrderController::class,
	    'merchant-applies' => MerchantApplyController::class,
	    'store-withdrawals' => StoreWithdrawalController::class,
	    
    ], ['only' => ['index', 'update', 'store', 'destroy', 'edit', 'create']]);

    $router->post('suppliers/get_supplierno', 'SupplierController@get_supplierno')->name('no');
    $router->post('staff/get-staffno', 'StaffController@staffNo')->name('staffNo');
    
    $router->resource('refund-config', RefundConfigController::class)->only(['edit', 'update']);
    
    $router->resource('orders', OrderController::class)->except(['create', 'update']);
    $router->resource('point-goods-orders', PointGoodsOrderController::class);
    // 跳转'refund-config'
	$router->get('refund', 'RefundConfigController@setRefundConfig')->name('refundConfig');
    // 图表统计
	$router->get('order-chart', 'Chart\OrderChartController@index')->name('orderChart');
	$router->get('room-chart', 'Chart\RoomChartController@index')->name('roomChart');
	$router->get('turnover-chart', 'Chart\TurnoverChartController@index')->name('turnoverChart');
	$router->get('member-chart', 'Chart\MemberChartController@index')->name('memberChart');
	$router->get('daily-chart', 'Chart\DailyChartController@index')->name('dailyChart');
	$router->get('material-chart', 'Chart\MaterialChartController@index')->name('materialChart');
	$router->post('material-chart', 'Chart\MaterialChartController@post')->name('materialChartPost');
	$router->get('goods-chart', 'Chart\GoodsChartController@index')->name('goodsChart');
	// 重写导出
	$router->get('material-export', 'Export\MaterialExportController@index')->name('materialExport.index');
	$router->any('material-export-post', 'Export\MaterialExportController@export')->name('stockExport');
	$router->get('member-export', 'Export\MemberExportController@index')->name('memberExport.index');
	$router->any('member-export-post', 'Export\MemberExportController@export')->name('memberExport');
	$router->get('room-export', 'Export\RoomExportController@index')->name('roomExport.index');
	$router->any('room-export-post', 'Export\RoomExportController@export')->name('roomExport');
	$router->get('goods-export', 'Export\GoodsExportController@index')->name('goodsExport.index');
	$router->any('goods-export-post', 'Export\GoodsExportController@export')->name('goodsExport');
	$router->get('order-export', 'Export\OrderExportController@index')->name('orderExport.index');
	$router->any('order-export-post', 'Export\OrderExportController@export')->name('orderExport');
	$router->get('turnover-export', 'Export\TurnoverExportController@index')->name('turnoverExport.index');
	$router->any('turnover-export-post', 'Export\TurnoverExportController@export')->name('turnoverExport');
	$router->get('daily-export', 'Export\DailyExportController@index')->name('dailyExport.index');
	$router->any('daily-export-post', 'Export\DailyExportController@export')->name('dailyExport');
	// 排班导入
	$router->get('schedule', 'Imports\ScheduleImportController@index')->name('schedule.index');
	$router->post('schedule', 'Imports\ScheduleImportController@Import')->name('schedule.import');
	// 考勤导入
	$router->get('attendance', 'Imports\AttendanceController@index')->name('attendance.index');
	$router->post('attendance', 'Imports\AttendanceController@import')->name('attendance.import');
	// 分门店特有路由
	$router->get('reception-machine', 'HomeController@notify');
	$router->get('goods', 'HomeController@notify');
	$router->get('goods-classifies', 'HomeController@notify');
	//$router->get('point-goods', 'HomeController@notify');
	$router->get('storeys', 'HomeController@notify');
	$router->get('businesstime', 'HomeController@notify');
	$router->get('scale', 'HomeController@notify');
	$router->get('room', 'HomeController@notify');
	$router->get('setmeal', 'HomeController@notify');
	$router->get('storedetail', 'HomeController@notify');
	$router->get('admin-users', 'HomeController@notify');
	// 南山分店财务报表
	$router->resource('main-point', 'Table\MainPointController');// 主要指标
	$router->resource('balance-sheet', 'Table\BalanceSheetController');//资产负债表
	$router->resource('cash-flow-sheet', 'Table\CashFlowSheetController');// 现金流表
	$router->resource('cost-sheet', 'Table\CostSheetController');// 费用表
	$router->resource('accounts-receivable', 'Table\AccountsReceivableController'); //应收帐款明细表
	$router->resource('advance-receipt', 'Table\AdvanceReceiptController');// 预收帐款明细表
	$router->resource('other-advance', 'Table\OtherAdvanceController'); // 其他应收帐款明细表
	$router->resource('bar-stocks', 'Table\BarStockController');// 吧台存货明细表

	$router->resource('special-even', 'Table\SpecialEvenController');// 待摊、预提及特殊调整事项明细表
	$router->resource('fruits-sanck', 'Table\FruitsSanckController');// 水果小食明细表
	$router->resource('warehouse-stock', 'Table\WarehouseStockController');// 仓库存货明细表

	$router->resource('payable', 'Table\PayableController');// 应付帐款明细表
	$router->resource('cash-list', 'Table\CashListController');// 现金盘点表
	$router->resource('construction-list', 'Table\ConstructionListController');// 在建工程明细表
	$router->resource('start-up-costs', 'Table\StartUpCostsController');// 待摊费用-开办费明细表
	$router->resource('other-payable', 'Table\OtherPayableController');// 其他应付款款明细表
	
	// 覆盖laravel admin默认路由
	$router->resource('auth/users', 'AdminUserController')->names('admin.auth.users');
});
